package lucava.gui;

import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class ImagePanel extends JPanel {

	private static final long serialVersionUID = 1L;

	public ImagePanel(String aFileName) {
		if (aFileName != null && !aFileName.isEmpty()) {
			try {
				BufferedImage myPicture = ImageIO.read(new File(aFileName));
				JLabel picLabel = new JLabel(new ImageIcon(myPicture));
				add(picLabel);

			} catch (Exception ex) {
				ex.printStackTrace();
				System.err.println("Erreur lors du chargement de l'image");
			}
		}
	}
}
